"use strict";

const Command = require("@luojia-cli-dev/command");

class InitCommand extends Command {
  init() {
    this.projectName = this._argv[0] || "";
    this.force = !!this._cmd.force;
    log.verbose("projectName", this.projectName);
    log.verbose("force", this.force);
  }

  exec() {
    try {
      console.log("init的业务逻辑");
      // 1. 准备阶段
      this.prepare();
      // 2. 下载模板
      // 3. 安装模板
    } catch (e) {
      log.error(e.message);
    }
  }

  prepare() {
    throw new Error("出错了");
  }
}
function init(argv) {
  return new InitCommand(argv);
}
module.exports = init;
module.exports.InitCommand = InitCommand;
